﻿@{
    Layout = null;

    string code = ViewBag.Code;
}

<!DOCTYPE html>

<html>
<head>
    <title>爱炒股联合登录</title>
    <script src="http://static.emoney.cn/js/libs/jquery.min.1.8.3.js" type="text/javascript"></script>
</head>
<body>
    <div id="divMsg"></div>
    <input type="hidden" id="hidCode" value="@code" />
    <input type="hidden" id="hidNick" value="@ViewBag.Nickname" />
    <input type="hidden" id="hidReturnUrl" value="@ViewBag.ReturnUrl" />
    <input type="hidden" id="hidBindUserID" value="@ViewBag.BindUserID" />
</body>
</html>
<script type="text/javascript">
    var verifierCode = $("#hidCode").val(), err = "", msg = "", url = $("#hidReturnUrl").val(), nick = $("#hidNick").val(), binduserid = $("#hidBindUserID").val();

    if (url != "") {
        window.location.href = "http://dsclient.emoney.cn/qq.html?nick=" + escape(nick);
    }
    else {
        if (verifierCode != "" && binduserid != "") {
            window.location.href = "http://dsclient.emoney.cn/istockclient/oauth/qq?code=" + verifierCode + "&returnUrl=bind|" + binduserid;
        }
        else {
            if (verifierCode == "") {
                err = "-1";
                msg = "获取临时授权code失败！";
            }
            else {
                err = "0";
                msg = "";
            }

            var data = "{\"err\": " + err + ",\"msg\": \"" + msg + "\",\"from\": " + 100 + ",\"code\": \"" + verifierCode + "\"}";

            try {
                window.external.OnCallLocalFunction("OnOAuthLogin", data);
            } catch (ex) {
            }
        }
    }
</script>